using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using XLua;

public class GameRoot : MonoBehaviour
{
    LuaEnv luaEnv;
    LuaFunction luaFunction;
    // Start is called before the first frame update
    void Start()
    {
        luaEnv = new LuaEnv();
        luaEnv.AddLoader((ref string s) => {
            return File.ReadAllBytes(Application.dataPath + "/Lua/" + s + ".lua");
        });
        luaEnv.DoString("require'StartClassLua'");
        luaFunction=luaEnv.Global.Get<LuaFunction>("OnUpdata");
    }

    // Update is called once per frame
    void Update()
    {
        if (luaFunction != null)
        {
            luaFunction.Call();
        }
    }
}

